<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>垫款资金流水表 管理</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">名称</div>
                    <div class="field">
                        <input name="" id="" type="text" class="ui-textbox" value="">
                    </div>
                </div>

                <div class="clearFix"></div>
                <div class="btnsBox">
                    <span id="searchBtn" class="sq-button sq-button-round">查询</span>
                    <span id="clearBtn" class="sq-button sq-button-round">清空</span>
                    <span id="addBtn" class="sq-button sq-button-round">新增</span>
                    <span id="changeBtn" class="sq-button sq-button-round">修改</span>
                    <span id="delBtn" class="sq-button sq-button-round">删除</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>
    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null,callback=null;
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/capital/capAdvFund/initList.do',
            method: 'get',
            columns: [
                {display: '资金编号 垫款（DK+ID）冲销（HB+ID）', name: 'code', minWidth: 100, align: 'left', enabledSort: false},
		{display: '批次号', name: 'batchId', minWidth: 100, align: 'left', enabledSort: false},
		{display: '客户ID', name: 'cstId', minWidth: 100, align: 'left', enabledSort: false},
		{display: '客户名称', name: 'cstNm', minWidth: 100, align: 'left', enabledSort: false},
		{display: '支付表ID', name: 'paySchId', minWidth: 100, align: 'left', enabledSort: false},
		{display: '支付表号', name: 'paySchNo', minWidth: 100, align: 'left', enabledSort: false},
		{display: '期次', name: 'payPd', minWidth: 100, align: 'left', enabledSort: false},
		{display: '金额', name: 'payAmt', minWidth: 100, align: 'left', enabledSort: false},
		{display: '付款银行账户ID(SYS_BK_ACC_INFO表ID、BANK_ACC_INFO表ID)', name: 'payBkId', minWidth: 100, align: 'left', enabledSort: false},
		{display: '付款账号', name: 'payAccNo', minWidth: 100, align: 'left', enabledSort: false},
		{display: '付款账户', name: 'payAccNm', minWidth: 100, align: 'left', enabledSort: false},
		{display: '付款开户银行', name: 'payBkNm', minWidth: 100, align: 'left', enabledSort: false},
		{display: '付款银行开户行号', name: 'payBkNo', minWidth: 100, align: 'left', enabledSort: false},
		{display: '收款银行账户ID(SYS_BK_ACC_INFO表ID、BANK_ACC_INFO表ID)', name: 'dueBkId', minWidth: 100, align: 'left', enabledSort: false},
		{display: '收款账户', name: 'dueAccNo', minWidth: 100, align: 'left', enabledSort: false},
		{display: '收款户名', name: 'dueAccNm', minWidth: 100, align: 'left', enabledSort: false},
		{display: '收款开户银行', name: 'dueBkNm', minWidth: 100, align: 'left', enabledSort: false},
		{display: '收款银行开户行号', name: 'dueBkNo', minWidth: 100, align: 'left', enabledSort: false},
		//{display: '资金属性(CAP0027 ): 1.租赁人还款 2.垫款 3.租赁人还款红冲', name: 'capAttrCdNm', minWidth: 100, align: 'left', enabledSort: false},
		{display: '垫款时间', name: 'advTm', minWidth: 100, align: 'left', enabledSort: false},
		{display: '垫款回拨时间', name: 'retTm', minWidth: 100, align: 'left', enabledSort: false},
		//{display: '垫款/回拨状态  0.未提交 1.已提交', name: 'fundStsCdNm', minWidth: 100, align: 'left', enabledSort: false},
		{display: '关联垫款资金ID', name: 'relFundId', minWidth: 100, align: 'left', enabledSort: false},
		{display: '日罚息率(%)', name: 'penaltyRate', minWidth: 100, align: 'left', enabledSort: false},
		{display: '资金使用成本', name: 'capUseCost', minWidth: 100, align: 'left', enabledSort: false},
		//{display: '(支付表)所属事业部', name: 'buOrgCdNm', minWidth: 100, align: 'left', enabledSort: false},
		{display: '备注', name: 'fundRem', minWidth: 100, align: 'left', enabledSort: false},
		{display: '版本', name: 'version', minWidth: 100, align: 'left', enabledSort: false},
		
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            //isScroll: false,
            checkbox: true,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: false
            /* onRenderComplete: function () {
             iframeResize ();
             } */
        });
        grid.setHeight(100);

        $("#searchBar").ligerForm();

        $("#pageloading").hide();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });

        /* 清空 */
        $("#clearBtn").click(function (event) {
            clearLigerForm("searchBar");
        });
        
        callback = function () {
            grid.reload();
        };

        /* 新增 */
        $("#addBtn").click(function (event) {
            $.ligerDialog.open({
                width: 550,
                height: 500,
                title: '新增垫款资金流水表',
                url:'<%=path%>/capital/capAdvFund/toAddPage.do'
            });
            //Add_navTab("CapAdvFund_1", "新增垫款资金流水表", '<%=path%>/capital/capAdvFund/toAddPage.do', callback);
        });

        /* 修改 */
        $("#changeBtn").click(function (event) {
            var selectedRows = grid.getSelectedRows();
            if (selectedRows.length != 1) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_ONLY_A_ROW, SQ_type: "warning"});
                return;
            }
            var _id=selectedRows[0].id;
            $.ligerDialog.open({
                width: 550,
                height: 500,
                title: '修改垫款资金流水表',
                url:'<%=path%>/capital/capAdvFund/toModifyPage.do?id='+_id
            });
            //Add_navTab('CapAdvFund_2'+_id, "修改垫款资金流水表", '<%=path%>/capital/capAdvFund/toModifyPage.do?id='+_id, callback);
        });

        /* 删除 */
        $("#delBtn").click(function () {
            var selectedRows = grid.getSelectedRows();
            if (selectedRows.length == 0) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_MORE_ROW, SQ_type: "warning"});
                return;
            }
            var _ids = [];
            for (var index in selectedRows) {
                _ids.push(selectedRows[index].id);
            }

            $.ligerDialog.confirm(LogUtils.LOG_CMM_DELETE_CONFIRM, function (flag) {
                if (flag == false)return;
                var wait_dialog;
                $.ajax({
                    type: 'post',
                    dataType: 'json',
                    data: {ids: JSON.stringify(_ids)},
                    url: '<%=path%>/capital/capAdvFund/removeByIds.do',
                    beforeSend: function () {
                        wait_dialog = $.ligerDialog.SQalert({
                            content: LogUtils.LOG_CMM_DATA_LOADING,
                            SQ_type: "waitting"
                        });
                    },
                    success: function (msg) {
                        wait_dialog.close();
                        if (msg.success == 1) {
                            $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                            grid.reload();
                        } else {
                            $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                        }
                    }
                });
            });
        });

    });

</script>

</body>
</html>
